<template>
	<view>

		<view :style="'background-image:url('+get_img+bgFunc()+');'" class="image">
		</view>
		<view class="list">抽奖记录</view>

		<view class="convert" v-for="(item,index) in user_goods" :key="index">
			<view class="img">
				<u--image height="130rpx" width="100rpx" :src="get_img+item.goods.image"></u--image>
			</view>
			<view class="active_1">
				<view>
					<p class="content_p">{{item.goods.name}}</p>
					<p class="updated_p">{{item.date}}</p>
				</view>
				<view class="receive">
					<view class="hx">
						<u-tag text="点我领取" type="error" size="mini" shape="circle" @click="hx(item)"></u-tag>
					</view>
				</view>
			</view>
			<view class="_a">
				<u-line color="#fff" hairline="false"></u-line>
			</view>
		</view>
		<u-popup :show="show" mode="center" @close="close" @open="open" closeable="true">
			<view class="jphx">
				<text>奖品核销</text>
			</view>
			<image :src="get_img+form.bind_box_qrcode" class="jphx_img"></image>
		</u-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				get_img: this.$get_img,
				sys: {},
				show: false,
				qrcode: "",
				form: {},
				user_goods: [],
				state: 0,
				pape: 1,
				num: 10,
			}
		},
		onLoad() {
			this.sys = uni.getStorageSync("sys")
			console.log("user_goods:", this.user_goods)
			this.get_hx()
		},
		onShow() {
			this.bind_goods()
		},
		methods: {
			bgFunc() {
				return this.sys.reward_bg != '' ? this.sys.reward_bg : this.sys.sys_background
			},
			bind_goods() {
				this.$model.get("user/task/get_user_bind_goods?state=" + this.state + "&pape=" + this.pape + "&num=" + this
					.num).then(
					res => {
						if (res.code == 200) {
							this.user_goods = res.data.data
						}
					})
			},
			open() {

			},
			close() {
				this.show = false
			},
			hx() {
				this.show = true
			},

			get_hx() {
				this.$model.get("user/task/create_bind_box_qrcode").then(res => {
					if (res.code == 200) {
						this.form = res.data
					}
				})
			},

		}

	}
</script>

<style>
	.image {
		background-repeat: no-repeat;
		background-size: cover;
		background-attachment: fixed;
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100vh;
		z-index: -1;
	}

	._a {
		width: 750rpx;
		margin-top: -20rpx;

	}

	.jphx {
		text-align: center;
		color: orangered;
	}

	.image1 {
		width: 100vw;
		height: 150px;
	}

	.active {
		color: #fff;
		background-color: rgba(255, 255, 255, .5);
		margin: -10rpx 0 0 0;
	}

	.jphx_img {
		width: 400rpx;
		height: 400rpx;
	}

	.active_1 {
		margin: -198rpx 200rpx 0 180rpx;
		height: 150rpx;
		width: 480rpx;
	}

	.convert {
		width: 100vw;
		height: 200rpx;
		color: #fff;
		margin-top: 10rpx;

	}

	.hx {
		/* margin: 50rpx 0 50rpx; */
		margin-top: 60rpx;

	}

	.content_p {
		margin: 50rpx 20rpx 20rpx 0;
		font-size: 35rpx;

	}

	.list {
		color: #fff;
		font-size: 40rpx;
		font-weight: 600;
		margin-top: 50rpx;
		margin-bottom: 20rpx;
		text-align: center;
	}

	.updated_p {
		margin: 0rpx 20rpx 50rpx 0;
		font-size: 30rpx;

	}

	.img {
		width: 100rpx;
		height: 150rpx;
		margin: 20rpx 20rpx 20rpx 30rpx;
	}

	.receive {
		float: right;
		margin-top: -188rpx;
	}
</style>
